<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>6.class_component</title>
</head>
<body>
  <div id="app"></div>

  <script src="lib/react.development.js"></script>
  <script src="lib/react-dom.development.js"></script>
  <script src="lib/babel.min.js"></script>
<script type="text/babel">
    class MyComponent extends React.Component{
        render(){
            console.log(this);
            return <h1>hello class component</h1>
        }
    }

    /*react会为类式组件创建一个对象然后通过对象.render的方式进行渲染
    * 所以render方法中的this是组件对象*/
    ReactDOM.render(<MyComponent/>,document.getElementById("app"))
</script>
</body>
</html>